package com.sikanrong;
import org.jruby.Ruby;
import org.jruby.javasupport.Java;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.javasupport.JavaUtil;
import org.jruby.runtime.Block;
import org.jruby.runtime.GlobalVariable;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.RubyInstanceConfig;
import java.io.*;
import java.net.URL;

import java.util.*;
import javax.swing.JApplet;
import java.lang.ClassLoader;
import javax.media.opengl.GLEventListener;

public class RubyGLWrapper{


	public GLEventListener getGLListener(){
		return (GLEventListener) new Object();
	}

	public static RubyGLWrapper getInterfaceFromScript(String contents){
		final Ruby runtime = Ruby.getDefaultInstance();
		
		runtime.evalScriptlet(contents);

		RubyGLWrapper ruby = null;
		final IRubyObject rawRuby = runtime.evalScriptlet("RubyGLListener.new");		
		ruby = (RubyGLWrapper) JavaEmbedUtils.rubyToJava(runtime, rawRuby, RubyGLWrapper.class);


		return ruby;
	}


}